new Vue({
  el: "#app",
  data() {
    return {
      rules: {},
      loading: false,
      form: {
        Company_Business_Personnel_SerialNumber: "",
        Company_Business_Personnel_Name: "",
        Company_Business_Personnel_Position: "",
        Company_Business_Personnel_Phone: "",
      },
    };
  },
  methods: {
    submitForm(formName) {
      console.log(this.form);
      let lArray = new Array();
      lArray.push(this.form);
      let lJSONObject_company_business_personnel = new Object();
      lJSONObject_company_business_personnel.company_business_personnel =
        lArray; //换表
      let lJSONObject_DataSet = new Object(); // Modify
      lJSONObject_DataSet.Add = lJSONObject_company_business_personnel; //换表
      console.log(lJSONObject_DataSet);
      const _this = this;
      $.ajax({
        // headers: requestHeaders(),
        // url: `${BASE_URL2}/generalBusiness/generalPaginationQueryBySQLSerialNumber`,
        url: "https://service.kdddy.cn/donghui/clientOperation/generalSaveForClient",
        type: "POST",
        data: {
          Data: JSON.stringify(lJSONObject_DataSet),
        },
        success: function (Result) {
          console.log(Result);
          if (Result.Status === "success") {
            _this.$message({
              message: "提交成功",
              type: "success",
            });
            window.history.go(-1);
          } else {
            _this.$message.error("提交失败，请稍后再试");
          }
        },
        complete: function (XMLHttpRequest) {
          requestPretreatment(XMLHttpRequest); //config/config.js 响应预检
        },
        dataType: "json",
      });
      return;
      this.$refs[formName].validate((valid) => {
        if (valid) {
          _this.loading = true;
          $.ajax({
            url: DomainName + "/getAddAction?token=" + $.cookie("token"),
            type: "POST",
            data: {
              Data: JSON.stringify({
                company_business_personnel: [_this.form],
              }),
              Operation_Name: "添加业务人员",
            },
            success: function (res) {
              if (res.Status == "success") {
                _this.$message.success("发布成功!");
                window.history.go(-1);
              }
            },
            error: function () {
              _this.$message.error("操作失败，请稍后再试");
            },
            // complete: function (XMLHttpRequest) {
            //     _this.loading = false
            //     if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            //         window.parent.document.location.href = absolutepath() + XMLHttpRequest.getResponseHeader("CONTENTPATH");
            //     }
            // }
          });
        } else {
          return false;
        }
      });
    },
  },
});
